/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: Test.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/22 下午2:58
 * LastModified: 2020/03/22 14:58:22
 */

package com.qolome.knowledge.design.pattern.memento.editor;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Qolome
 * @version V1.0
 * @Description 测试类
 * @date 2020年 03月22日 14:58:42
 */
@Slf4j
public class Test {

    public static void main(String[] args) {
        DraftsBox draftsBox =new DraftsBox();
        Editor editor = new Editor("阿衰第一季第一集","同桌的表妹","www.ashuai.com");
        ArticleMemento first = editor.saveToMemento();
        draftsBox.addMemento(first);
        log.info("首次文本内容:{}",first);
        editor.setTitile("阿衰第一季第二集");
        editor.setContent("表妹的同桌");
        ArticleMemento two = editor.saveToMemento();
        log.info("二次文本内容:{}",two);
        draftsBox.addMemento(two);
        editor.setTitile("阿衰第一季第三集");
        editor.setContent("表妹与同桌");
        ArticleMemento three = editor.saveToMemento();
        log.info("三次文本内容:{}",three);
        draftsBox.addMemento(three);
        ArticleMemento backone = draftsBox.getMemento();
        log.info("第一次恢复文档:{}",backone);
        ArticleMemento backtwo = draftsBox.getMemento();
        log.info("第二次恢复文档:{}",backtwo);

    }

}
